package com.stormrage.edu.serv.edu.view.impl;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.stormrage.edu.dao.edu.view.EduChapterVideoDao;
import com.stormrage.edu.serv.edu.view.EduChapterVideoServ;
import com.stormrage.entity.edu.view.EduChapterVideo;
import com.stormragetech.core.exception.StormrageTechException;

/**
 * @Title: EduChapterVideoServImpl.java
 * @Package com.stormrage.edu.serv.edu.view.impl
 * @Description: 章节、课件关联 Dao
 * @author www.stormragetech.com
 * @date 2016年4月8日
 * @version V1.0
 */
@Service
public class EduChapterVideoServImpl implements EduChapterVideoServ {

	private static final Logger logger = LoggerFactory.getLogger(EduMajorModuleServImpl.class);

	@Autowired
	private EduChapterVideoDao eduChapterVideoDao;

	@Override
	public Integer create(final EduChapterVideo arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 Create 】- 开始运行 ");

		Integer index = eduChapterVideoDao.create(arg0);

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 Create 】- 完成运行 ");
		return index;
	}

	@Override
	public void deleteById(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 DeleteById 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("id", arg0);

		eduChapterVideoDao.deleteById(map);

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 DeleteById 】- 完成运行 ");
	}

	@Override
	public void deleteByChapterId(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 DeleteByChapterId 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("id", arg0);

		eduChapterVideoDao.deleteByChapterId(map);

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 DeleteByChapterId 】- 完成运行 ");
	}

	@Override
	public void deleteByVideoId(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 DeleteByVideoId 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("id", arg0);

		eduChapterVideoDao.deleteByVideoId(map);

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 DeleteByVideoId 】- 完成运行 ");
	}

	@Override
	public Integer queryCountById(final Integer arg0) throws StormrageTechException {

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 QueryCountById 】- 开始运行 ");

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("id", arg0);

		Integer count = eduChapterVideoDao.queryCountById(map);

		logger.debug(" 【 Serv 】- 【 EduChapterVideoServ 】- 【 QueryCountById 】- 完成运行 ");
		return count;
	}

}
